class A
{
    public int test() 
    {
        println(">>> Called test() in class A. <<<");
        return 0;
    }
}

class B extends A
{
    public int callParentFunction() 
    {
        println(">>> Called callParentFunction() in class B. <<<");
        println("    This function will now call the parent's (class A's) test() without object-referencing.");
        test();
        return 0;
    }
}

class C
{
    public int callGlobalTestFromC() 
    {
        println(">>> Called callGlobalTestFromC() in class C. <<<");
        println("    This function will now call the global function test(), not the one in class A.");
        test();
        return 0;
    }
}

int test() 
{
    println(">>> Called global function test() <<<");
    return 0;
}

int main()
{
    println("");
    println("The program does the following:");
    println("1. a.test();");
    println("2. b.callParentFunction();    Should call A's test().");
    println("3. c.callGlobalTestFromC();   Should call the global function test().");
    println("4. test();                    Should call the global function test().");
    A a;
    B b;
    C c;
    println("");
    println("1.");
    a.test();
    println("");
    println("2.");
    b.callParentFunction();
    println("");
    println("3.");
    c.callGlobalTestFromC();
    println("");
    println("4.");
    test();
    return 0;
}
